/**
 * FileSystemStoreHandler
 *
 * This is a jetty handler for FileSystemStores
 */
package uk.co.sheitgeist.fums.server.content.transport.http

import uk.co.sheitgeist.fums.server.content.store.filesystem.FileSystemStore
import uk.co.sheitgeist.fums.server.content.store.*

import org.mortbay.jetty.Handler
import org.mortbay.jetty.handler.ResourceHandler

import java.util.logging.Logger;

public class FileSystemStoreHandler extends ResourceHandler {
	
	private static Logger logger = Logger.getLogger("uk.co.sheitgeist")
	Store store
	public FileSystemStoreHandler(FileSystemStore store) {
		super()
		setResourceBase(store.root.toString())
		this.store = store
	}

	public getStorePath(String storeNodePath) {
		logger.info "fssh:${storeNodePath}:${getResourceBase()}"
		return storeNodePath.substring(store.root.toString().length() + 1)
	}
}
